/**
 * 
 */
package Media.ui;

import org.eclipse.swt.widgets.Shell;

/**
 * @author Hardeep
 *
 */
public class UIExtendable implements UIInterface {
	protected Shell shell = null;
	protected Shell parent = null;

	/* (non-Javadoc)
	 * @see ui.UIInterface#closeShell()
	 */
	public void closeShell() {
		if ( parent != null )
			parent.setEnabled(true);
		if ( !shell.isDisposed() ) {
			shell.close();
			shell.dispose();
		}
	}

	/* (non-Javadoc)
	 * @see ui.UIInterface#createShell()
	 */
	public void createShell() {}

	/* (non-Javadoc)
	 * @see ui.UIInterface#getShell()
	 */
	public Shell getShell() {
		return shell;
	}
	
	public Shell open() {
		if ( parent != null )
			parent.setEnabled(false);
		shell.open();
		return shell;
	}

	/* (non-Javadoc)
	 * @see ui.UIInterface#setParentShell(org.eclipse.swt.widgets.Shell)
	 */
	public void setParentShell(Shell p) {
		parent = p;
	}

}
